<template>
<div class="List">
    <var-pull-refresh v-model="isRefresh" @refresh="refresh">
        <var-list :finished="finished" v-model:loading="loading" @load="onLoad">
            <var-cell :key="item" v-for="item in list" :title="item.Title" :desc="item.PromulgateDate">
            </var-cell>
        </var-list>
    </var-pull-refresh>
</div>
</template>

<script>
import api from '@/api/news.js'
//import LHeader from '@/components/layout/LHeader.vue'

export default {
    name: 'List',
    components: {},
    data() {
        return {
            finished: false,
            loading: false,

            isRefresh:false,

            list: [],
            pageIndex: 0,
            pageSize: 30,
        }
    },
    methods: {
        refresh(){
            this.pageIndex =0;
            this.onLoad()
        },
        async onLoad() {
            this.pageIndex++;
            let obj = {
                PageNo: this.pageIndex,
                PageSize: this.pageSize,
                ClassifyID: "11A4D701-BBA8-4D27-B53F-184D8094EB3D"
            };
            let data = await api.getList(obj);
            if (data.success) {
                if (this.pageIndex == 1) {
                    this.list = data.data;
                } else {
                    this.list = this.dox.doArrayConcat(this.list, data.data);
                }
                this.loading = false;
                this.isRefresh = false;

                // 数据全部加载完成
                if (data.data.length < this.pageSize) {
                    this.finished = true;
                }
            }
            console.log('测试', data)
        },
        viewDetail(item) {
            //this.$router.push({path:'/cityCaseDetail/'+ item.id});
        }
    },
    mounted() {}
};
</script>

<style lang="scss" scoped>
.List {}
</style>
